package com.dinzeer.lostbladereborn.mixin;


import com.dinzeer.legendreliclib.lib.StackReg;
import com.dinzeer.lostbladereborn.regsitry.LBRSpecialEffectRegsitry;
import com.dinzeer.lostbladereborn.se.SpecialEffectEx;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EnchantmentHelper.class)
public class MobLootingMixin {
    @Inject(method = "getMobLooting",at = @At(value = "HEAD"), cancellable = true)
    private static void getMobLooting(LivingEntity livingEntity, CallbackInfoReturnable<Integer> cir) {
        if (livingEntity instanceof Player player) {
            if (SpecialEffectEx.hasSpecialEffect2(player.getMainHandItem(), LBRSpecialEffectRegsitry.Phecda.getId(),player)){
                int v = 1;
                if (StackReg.COMBO_NUMBER.getCurrentStacks(player) >10){
                    v = 2;
                }
                cir.setReturnValue(cir.getReturnValueI()+ v);
            }
        }
    }
}
